/*******************************************************************************
 * Copyright (c) 2011 Olexandr V. Shaposhnikov.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Olexandr V. Shaposhnikov - initial API and implementation and/or initial documentation
 *******************************************************************************/
package com.funkyroach.use.core.search;

import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.core.search.matching.MatchLocator;
import org.eclipse.dltk.core.search.matching.MatchLocatorParser;
import org.eclipse.dltk.core.search.matching.PatternLocator;

import com.funkyroach.use.core.ast.USArgument;
import com.funkyroach.use.core.ast.USFuncDeclaration;
import com.funkyroach.use.core.ast.USVariableDeclaration;

public class USMatchLocatorParser extends MatchLocatorParser {

	protected USMatchLocatorParser(MatchLocator locator) {
		super(locator);
	}

	protected void processStatement(ASTNode node, PatternLocator locator) {
		if (node == null) {
			return;
		}
//		System.out.println("--------------------------==================");
//		System.out.println(node);
//		System.out.println("--------------------------==================");
		if (node instanceof USFuncDeclaration) {
//			USFuncDeclaration astFuncDecl = (USFuncDeclaration)node;
//			List<USArgument> args = astFuncDecl.getArguments();
//			for (USArgument arg : args) {
//				locator.match(arg, this.getNodeSet());
//			}
//			System.out.println("METHOD = " + node);
		} else if (node instanceof USVariableDeclaration) {
			locator.match(node, this.getNodeSet());
		} else if (node instanceof USArgument) {
			locator.match(node, this.getNodeSet());
		}
	}
}
